package com.hs.sfzy.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * @description:  问题实体
 * @author: 陈千鱼不是鱼
 * @date: 2024/10/24 17:30
 **/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class Question {

  private Long id;
  private String title;
  private String content;
  private Long replyCount;
  public void setReplyCount(Long replyCount){
    if (replyCount == null) this.replyCount = 0l;
    else this.replyCount = replyCount;
  }
  @DateTimeFormat(pattern = "yyyy-MM-dd")
  @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
  private Date lastReplyTime;
  public void setLastReplyTime(Date lastReplyTime){
    if (lastReplyTime == null) this.lastReplyTime = new Date();
    else this.lastReplyTime = lastReplyTime;
  }
  @DateTimeFormat(pattern = "yyyy-MM-dd")
  @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
  private Date createTime;
  private Long userId;
  private User user;

  private String byCreateTime;

  private String byCount;

}
